<template>
	<view class="content">
		<view class="index">
			<u-navbar leftText="" :is-back="false" safeAreaInsetTop placeholder>
				<view slot="left" class="leftText">我要招工</view>
			</u-navbar>
			<view style="grid-template-columns: 1fr 4fr;display: grid; margin-bottom: 10px;">
				<image mode="aspectFill" style="width: 35px;height: 35px;margin-left: 8px;"
					src="https://xgr.oss-cn-hangzhou.aliyuncs.com/icon/index/mini-logo.png">
				</image>
				<u-search style="width: 100%;" placeholder="搜索你要找的师傅"></u-search>
			</view>
			<view class="header-nav">
				<view class="header-item dis-row row-box">
					<view class="hd-itemleft dis-row">
						<view class="hot-child poser" v-for="(childNavItem,childNavIndex) in leftNav"
							@click="tabNavChild(childNavItem,childNavIndex)" :key="childNavIndex"
							:class="{'checkNavItem':current == childNavIndex}">
							{{childNavItem.name}}
							<label v-if="current == childNavIndex"></label>
						</view>
					</view>
					<view class="hd-itemright dis-row">
						<!-- <view class="child-lst dis-row" @click="checkNavGongZhong">
							<text>{{skillsName}}</text>
							<label><u-icon name="arrow-down" color="#424242" size="12"></u-icon></label>
						</view> -->
						<view class="child-lst dis-row" @click="cleanAddresIndex">
							<text>{{cityName}}</text>
							<label><u-icon name="arrow-down" color="#424242" size="12"></u-icon></label>
						</view>
						<!-- <view class="child-lst dis-row" @click="postPerson">
							<text>人员构成</text>
							<label><u-icon name="arrow-down" color="#424242" size="12"></u-icon></label>
						</view> -->
						<view class="child-lst dis-row" @click="postSaixuan">
							<text>筛选</text>
							<label><u-icon name="arrow-down" color="#424242" size="12"></u-icon></label>
						</view>
					</view>
				</view>
			</view>
		</view>
		<!--列表部分-->
		<view class="list-item dis-clm">
			<!--list start-->
			<block v-if="cardList && cardList.length>0">
				<block v-for="(item,index) in cardList" :key="index">
					<view class="master-block" v-if="item.nickName !=null" @click="JumpNext(item)">
						<view class="master-item">
							<view class="master-faceItem poser dis-row">
								<!--头像处理start-->
								<view class="faceItem-ico poser">
									<image
										:src="item.avatar?item.avatar:'https://xgr.oss-cn-hangzhou.aliyuncs.com/icon/images/default-avatar.png'">
									</image>
									<!-- <label v-if="item.staffTypeStr">{{item.staffTypeStr}}</label> -->
								</view>
								<!--头像处理over-->
								<!--顶部右侧标题文字开始-->
								<view class="faceText dis-clm">
									<!--置顶信息start-->
									<view class="faceText-t1 dis-row">
										<view class="zhidding" v-if="item.top">置顶</view>
										<view class="master-name">{{item.nickName.charAt(0)}}{{item.gender==1?'先生':item.gender==2?'女士':'先生'}}</view>
										<block v-if="item.isRealName">
											<label>
												<image
													src="https://xgr.oss-cn-hangzhou.aliyuncs.com/icon/images/user-real.svg">
												</image>
											</label>
											<text>实名认证</text>
										</block>
									</view>
									<!--置顶信息over-->
									<view class="master-userinfo dis-row">
										<text v-if="item.gender">
											<block v-if="item.gender==1">男</block>
											<block v-else-if="item.gender==2">女</block>
										</text>
										<text v-if="item.age">{{item.age}}岁</text>
										<text v-if="item.nation">{{item.nation}}</text>

									</view>
									<view class="zpList-right">
										<view class="zplistrv-s1" v-if="item.salary">
											<label>{{item.salary}}-{{item.salaryMax}}元/月</label>
										</view>
										<!-- <view class="zplistrv-s1" v-else><label>面议</label></view> -->
										<!-- <view class="zpList-s2">期望薪资</view> -->
									</view>
								</view>
								<!--顶部右侧标题文字结束-->
								<!--是否在线开始-->
								<!-- <view class="master-t3 dis-row" v-if="item.status!==''">
								<view><label></label></view><text>今日找活中</text>
							</view> -->
								<!--是否在线结束-->
							</view>
							<!--标签列表开始-->
							<view class="bloc-small">
								<label v-if="item.workYear">{{item.workYear}}年工龄</label>
								<label v-if="item.workType1">{{item.workType1}}</label>
								<label v-if="item.mastery">{{item.mastery}}</label>
							</view>
							<view class="block-pre" style="color: #A1A1A1;font-size: 28rpx;">{{item.notice}}</view>
							<!--标签列表结束-->
							<!--底部开始哦-->
							<view class="master-zpList dis-clm poser">
								<view class="left">
									<view v-if="item.skills" class="zpList-child dis-row">
										<label>期望工种</label><text>{{item.skills?strHandle(item.skills):''}}</text>
									</view>
									<view v-if="item.hopeAddr" class="zpList-child dis-row">
										<label>期望地点</label><text>{{item.hopeAddr?strHandle(item.hopeAddr):''}}</text>
									</view>
								</view>
								<!-- <view class="master-t3 dis-row" v-if="item.status!==''">
								<view><label></label></view><text>找活中</text>
							</view> -->
							</view>
							<!--底部结束-->
						</view>
					</view>
				</block>
				<view v-if="notMore==1"
					style="text-align: center; color: #333; line-height: 100rpx; background: #f3f3ff;">没有更多了...</view>
			</block>
			<!--list over-->
			<block v-else>
				<view class="empty-img">
					<image src="https://xgr.oss-cn-hangzhou.aliyuncs.com/icon/images/icon50.png"></image>
				</view>
			</block>
		</view>
		<!-- <drt
		:imgsrc="advimgsrc"
		:isDock="true"
		:existTabBar="true"
		@btnClick="btnClick"
		@btnTouchstart="btnTouchstart"
		@btnTouchend="btnTouchend"></drt> -->
		<view class="drtint dis-clm" @click="showzg = true">
			<label>+</label>
			<text>发布</text>
		</view>
		<uTabbar :value="1"></uTabbar>

		<u-popup :show="saixuanshow" :round="10" mode="bottom" @close="saixuanclose" @open="saixuanopen"
			closeIconPos="top-right" closeable="true">
			<view class="pop-saixuan dis-clm">
				<view class="saixuan-name">筛选</view>
				<view class="saixuan-childName v-box">师傅年龄(多选)</view>
				<view class="saixuan-childList">
					<label v-for="(item,index) in ageList" :key="index" :class="item.active==1?'pp-active':''"
						@click="ageChange(index,item.active)">{{item.name}}</label>
				</view>
				<view class="saixuan-childName v-box">长短工(多选)</view>
				<view class="saixuan-childList">
					<label v-for="(item,index) in workTypeList" :key="index" :class="item.active==1?'pp-active':''"
						@click="workChange(index,item.active)">{{item.name}}</label>
				</view>
				<view class="saixuan-childName v-box">熟练度(多选)</view>
				<view class="saixuan-childList">
					<label v-for="(item,index) in masteryList" :key="index" :class="item.active==1?'pp-active':''"
						@click="masteryChange(index,item.active)">{{item.name}}</label>
				</view>
				<view class="saixuan-childName v-box">结算方式(多选)</view>
				<view class="saixuan-childList">
					<label v-for="(item,index) in settlementList" :key="index" :class="item.active==1?'pp-active':''"
						@click="settlementChange(index,item.active)">{{item.settlement}}</label>
				</view>
				<view class="saixuan-childName v-box">实名、证书、项目、视频(多选)</view>
				<view class="saixuan-childList">
					<label :class="extype1==1?'pp-active':''" @click="others(1)">实名认证</label>
					<label :class="extype2==1?'pp-active':''" @click="others(2)">技能证书</label>
					<label :class="extype3==1?'pp-active':''" @click="others(3)">项目经验</label>
					<label :class="extype4==1?'pp-active':''" @click="others(4)">找活视频</label>
				</view>
				<view class="pop-saixuanfooter dis-row row-box">
					<view class="saixuan-leftbtn" @click="clearChange()">清除</view>
					<view class="saixuan-righttbtn" @click="defineChange()">确定选择</view>
				</view>
			</view>
		</u-popup>

		<u-popup :show="personshow" :round="10" mode="bottom" @close="personclose" @open="personopen"
			closeIconPos="top-right" closeable="true">
			<view class="person-pop dis-clm">
				<view class="saixuan-name">人员构成</view>
				<view class="person-lst dis-clm">
					<view class="person-item" :class="0==staffType?'personActice':''" @click="personChange(0)">全部</view>
					<view class="person-item" :class="item.id==staffType?'personActice':''"
						v-for="(item,index) in personList" :key="index" @click="personChange(item.id)">{{item.name}}
					</view>
				</view>
				<view class="person-sure" @click="personDefine()">确定</view>
			</view>
		</u-popup>

		<!--地址-->
		<pop ref="city" :direction="direction" :is_close="true" :is_mask="true" :width="100">
			<view class="con-del dis-clm" v-if="cityList && cityList.length>0">
				<view class="cityName">选择地点</view>
				<view class="cityList dis-row">
					<view class="sheng dis-clm">
						<scroll-view scroll-y="true">
							<view class="sheng-Lst" v-for="(cityitem,cityindex) in provinceList" :key="cityindex"
								:class="{'shengActive':(cityitem.active==1)}" @click="cityClick(cityitem,cityindex,1)">
								{{cutstr(cityitem.name,10)}}
							</view>
						</scroll-view>
					</view>
					<view class="shi dis-clm">
						<scroll-view scroll-y="true">
							<view class="shi-lst" v-for="(shiItem,shiIndex) in cityList" :key="shiIndex"
								:class="{'shiActive':(shiItem.active==1)}" @click="cityClick(shiItem,shiIndex,2)">
								{{cutstr(shiItem.name,10)}}
							</view>
						</scroll-view>
					</view>
					<!-- <view class="qu dis-clm">
						<scroll-view scroll-y="true">
							<view class="qu-lst" v-for="(quitem,quindex) in countyList" :key="quindex"
							:class="{'quActive':(quitem.active==1)}"
							@click="cityClick(quitem,quindex,3)"
							>{{cutstr(quitem.name,10)}}</view>
						</scroll-view>
					</view> -->
				</view>

				<!-- <view class="addres-footer dis-row">
					 <view class="addres-btn" @click="cleanNew">清除</view>
					 <view class="addres-btn" @click="citySure">确定选择</view>
				</view> -->
			</view>
		</pop>

		<!--全部工种-->
		<pop ref="gongzhong" :direction="direction" :is_close="true" :is_mask="true" :width="100">
			<view class="con-del dis-clm">
				<view class="cityName">全部工种</view>
				<view class="checkgongzhongLList row-box" v-if="selectCheckgognzhong.length>0">
					<view v-for="(se,sc) in selectCheckgognzhong" :key="sc" class="dis-row" @click="delSelectgz(se,sc)">
						<text>{{se.skillName}}</text><label>
							<image src="https://xgr.oss-cn-hangzhou.aliyuncs.com/icon/icon/cc.png"></image>
						</label>
					</view>
				</view>
				<view class="cityList dis-row">
					<view class="sheng dis-clm">
						<scroll-view scroll-y="true">
							<view class="sheng-Lst" v-for="(gzitem,gzindex) in gongzhongList" :key="gzindex"
								:class="{'shengActive':(gzlevelone==gzindex)}" @click="gzTaskLevelone(gzitem,gzindex)">
								{{cutstr(gzitem.skillName,10)}}
							</view>
						</scroll-view>
					</view>
					<view class="leveltwo dis-clm" v-if="gongzhongList[gzlevelone] && gongzhongList[gzlevelone].child">
						<scroll-view scroll-y="true">
							<view class="shi-lst" v-for="(shiItem,shiIndex) in gongzhongList[gzlevelone].child"
								:key="shiIndex" :class="{'shiActive':(gzleveltwo === shiIndex)}"
								@click="gzTaskLevelTwo(shiItem,shiIndex)" style="width: 400rpx;">
								{{shiItem.skillName}}
							</view>
						</scroll-view>
					</view>

				</view>
				<!-- <view class="addres-footer dis-row">
					 <view class="addres-btn" @click="cleanGongZhongIndex">清除</view>
					 <view class="addres-btn" @click="getCheckGongZhong">确定选择</view>
				 </view> -->
			</view>
		</pop>

		<u-popup :show="setTop" :round="10" mode="bottom" zIndex="99999" :closeable="true" @close="closeTop">
			<view class="setTop">
				<view class="title">选择置顶</view>
				<scroll-view scroll-y="true" style="max-height:500rpx; margin-bottom: 20rpx;">
					<view class="userMp" v-if="mytopList.card" :class="{'active':topType==1}"
						@click="changeTop(mytopList.card,1)">
						<image
							:src="mytopList.card.avatar?mytopList.card.avatar:'https://xgr.oss-cn-hangzhou.aliyuncs.com/icon/images/my/1.jpg'">
						</image>
						<view class="userName">
							<view class="userNameS">
								<view class="name">{{mytopList.card.nickName}}</view>
								<block v-if="mytopList.card.isRealName == 1">
									<image src="https://xgr.oss-cn-hangzhou.aliyuncs.com/icon/images/user-real.svg" />
									<view class="authMe">实名认证</view>
								</block>
							</view>
							<view class="userNameC">
								<text>{{mytopList.card.gender==1?'男':'女'}}</text><text>{{mytopList.card.age}}</text><text>{{mytopList.card.nationName}}</text>
							</view>
						</view>
						<view>个人名片</view>
					</view>
					<block v-if="mytopList.orders">
						<view class="job" v-for="(od,oi) in mytopList.orders" :key="oi"
							:class="{'active':topType==2 && topId==od.id}" @click="changeTop(od,2)">
							<!-- <view>{{od.address}}、{{od.skills}}</view> -->
							<view v-if="od.titleName">{{cutstr(od.titleName,70)}}</view>
							<view>{{cutstr(od.workDesc,94)}}</view>
						</view>
					</block>
				</scroll-view>
				<u-button type="primary" customStyle="background:#0575FF; font-size:32rpx; margin-bottom: 24rpx;"
					text="确定选择" @click="sendCheckSet"></u-button>
			</view>
		</u-popup>
		<!-- 发布弹出层 -->
		<u-popup :show="showzg" @close="closezg" closeOnClickOverlay safeAreaInsetBottom zIndex='99999' >
			<view style="background-color: #f0f0f0;">
				<text style="display: flex;margin: 20rpx auto;justify-content: center;">发布</text>
				  <view class="zgbtn" @click="btnClick">
		                <u-button>我要招工人</u-button>
		            </view>
					<view v-if="showcard" class="zgbtn" @click="btnClick2">
						<u-button>我要找工作</u-button>
					</view>
			</view>
		          
					
		</u-popup>
	</view>
</template>
<script>
	import uTabbar from "@/components/uTabbar/uTabbar.vue";
	import store from '@/common/store.js'
	import Index from '@/common/index-model.js'
	import pop from "@/components/ming-pop/ming-map.vue"
	let index = new Index()
	export default {
		data() {
			return {
				homepage: '',
				showzg:false,
				containerWidth: 0, // 容器宽度
				textWidth: 60, // 文本宽度
				show: false,
				horizontal: 'right',
				vertical: 'bottoms',
				search: "",
				advimgsrc: "https://xgr.oss-cn-hangzhou.aliyuncs.com/icon/images/release.svg",
				leftNav: [{
					name: '推荐'
				}, {
					name: '最新'
				}],
				current: 0,
				lTab: 0,
				direction: "below",
				saixuanshow: false,
				personshow: false,
				cardList: [],
				topcardList: [],
				pcardList: [],
				personList: [],
				ageList: [],
				workTypeList: [],
				masteryList: [],
				settlementList: [],
				cityLists: [],
				provinceList: [],
				cityList: [],
				countyList: [],
				selectCheckgognzhong: [],
				gongzhongList: {},
				gzlevelone: 0,
				gzleveltwo: '',
				skillsName: '工种',
				cityName: '地点',
				pages: 0,
				tpageNum: 2,
				ppageNum: 8,
				type: 0,
				staffType: 0,
				skills: 0,
				cityId: 0,
				areaId: 0,
				mastery: 0,
				ageSection: 0,
				workType1: 0,
				settlement: 0,
				extype1: 0,
				extype2: 0,
				extype3: 0,
				extype4: 0,
				setTop: false,
				mytopList: [],
				topType: 0,
				topId: 0,
				userinfo: {},
				pageIndex: 0,
				pageSize: 10,
				notMore: 0,
			}
		},
		components: {
			pop
		},
		onShow() {
			uni.showShareMenu({
				title: '找活干、招工人，就用天下工人',
				imageUrl: 'https://xgr.oss-cn-hangzhou.aliyuncs.com/icon/%E5%BE%AE%E4%BF%A1%E5%9B%BE%E7%89%87_20230327160119.png'
			});
			this.skills = 0; //工种
			this.cityId = 0; //城市
			this.staffType = 0; //人员构成
			this.mastery = 0; //熟练度
			this.ageSection = 0; //年龄段
			this.workType1 = 0; //长短工
			this.settlement = 0; //结算方式
			this.extype1 = 0;
			this.extype2 = 0;
			this.extype3 = 0;
			this.extype4 = 0;
			this.skillsName = '工种';
			this.cityName = '地点';
			this.pageIndex = 0;
			this.notMore = 0;
			this.getTopWorkerList();
			this.getWorkerList();
			this.getHomepage()
			if (uni.getStorageSync('token')) {
				this.getUserInfo();
			}
		},
		onPullDownRefresh() {
			// this.skills=0;//工种
			// this.cityId=0;//城市
			// this.staffType=0;//人员构成
			// this.mastery=0;//熟练度
			// this.ageSection=0;//年龄段
			// this.workType1=0;//长短工
			// this.settlement=0;//结算方式
			// this.extype1=0;
			// this.extype2=0;
			// this.extype3=0;
			// this.extype4=0;
			// this.skillsName='工种';
			// this.cityName='地点';
			this.pageIndex = 0;
			this.notMore = 0;
			this.getTopWorkerList();
			this.getWorkerList();
			setTimeout(function() {
				uni.stopPullDownRefresh();
			}, 1000);
		},
		onReachBottom() {
			if (this.notMore == 0) {
				this.getWorkerList();
			}
		},
		methods: {
			getHomepage() {
				if (!uni.getStorageSync('token')) {
					return false
				} else {
					index.getPublicUserMember({}, '/client/individual/homePage', 'get', res => {
						if (res.data.code == 200 && res.data.success) {
							this.homepage = res.data.result;
							console.log('homepage', this.homepage)
						} else {
							return false
						}
					})
				}
			},
			isShowgz() {
				if (!uni.getStorageSync('token')) {
					index.navigate_to('/pagesC/login/login');
					return false
				} else {
					index.getPublicUserMember({}, '/client/individual/homePage', 'get', res => {
						if (res.data.code == 200 && res.data.success) {
							this.showzg = true
							if (res.data.result.enIdentity != 0) {
								this.showcard = false
							} else {
								this.showcard = true
							}
							this.enIdentity = res.data.result.enIdentity
			
						} else if (res.data.code == '401') {
							uni.removeStorageSync('');
							index.navigate_to('../../pagesC/login/login');
						} else {
							index.show_tips(res.data.message);
							return false
						}
					})
			
				}
			
			},
			getUserInfo() {
				index.getPublicUserMember({}, 'client/individual/select/information', 'post', res => {
					if (res.data.code == 200 && res.data.success) {
						this.userinfo = res.data.result;
					}
				})

			},
			navSearch() {
				index.navigate_to('/pagesB/worksearch/index')
			},
			changeTop(item, type) {
				this.topType = type;
				if (type == 1) {
					this.topId = item.cardId;
				} else {
					this.topId = item.id;
				}
			},
			closeTop() {
				this.setTop = false
			},
			//置顶信息
			sendCheckSet() {
				if (!this.topId) {
					index.show_tips('请选择置顶内容');
					return false;
				}
				let url;
				if (this.topType == 1) {
					url = '/pagesC/mpTop/index?id=' + this.topId;
				} else {
					url = '/pagesC/jobTop/index?id=' + this.topId;
				}
				this.setTop = false
				index.navigate_to(url)
			},
			MyZdList() {
				index.getPublicUserMember({}, 'client/public/getCanTopList', 'get', res => {
					if (res.data.code == 200 && res.data.success) {
						this.mytopList = res.data.result
						this.setTop = true
					} else {
						index.show_tips(res.data.message)
						this.setTop = false
						return false
					}
				})
			},
			//获取年龄段
			getAgeList() {
				index.getPublicUserMember({}, '/client/public/find/age/section', 'get', res => {
					let ageList = [];
					if (res.data.code == 200 && res.data.success) {
						res.data.result.forEach((item, index) => {
							item.active = 0;
							ageList.push(item);
						})
						this.ageList = ageList;
					}
				})
			},
			ageChange(index, active) {
				this.ageList[index].active = Math.abs(active - 1);
				let ageSection = '';
				this.ageList.forEach((item, i) => {
					if (item.active == 1) {
						ageSection += item.id + ',';
					}
				})
				this.ageSection = ageSection;
			},
			//获取长短工
			getWorkTypeList() {
				index.getPublicUserMember({}, '/client/public/find/workTypeOne', 'get', res => {
					let workTypeList = [];
					if (res.data.code == 200 && res.data.success) {
						res.data.result.forEach((item, index) => {
							item.active = 0;
							workTypeList.push(item);
						})
						this.workTypeList = workTypeList;
					}
				})
			},
			workChange(index, active) {
				this.workTypeList[index].active = Math.abs(active - 1);
				let workType1 = '';
				this.workTypeList.forEach((item, i) => {
					if (item.active == 1) {
						workType1 += item.id + ',';
					}
				})
				this.workType1 = workType1;
			},
			//获取熟练度
			getMasteryList() {
				index.getPublicUserMember({}, '/client/public/find/mastery', 'get', res => {
					let masteryList = [];
					if (res.data.code == 200 && res.data.success) {
						res.data.result.forEach((item, index) => {
							item.active = 0;
							masteryList.push(item);
						})
						this.masteryList = masteryList;
					}
				})
			},
			masteryChange(index, active) {
				this.masteryList[index].active = Math.abs(active - 1);
				let mastery = '';
				this.masteryList.forEach((item, i) => {
					if (item.active == 1) {
						mastery += item.id + ',';
					}
				})
				this.mastery = mastery;
			},
			//获取结算方式
			getSettlementList() {
				index.getPublicUserMember({}, '/client/public/find/settlement', 'get', res => {
					let settlementList = [];
					if (res.data.code == 200 && res.data.success) {
						res.data.result.forEach((item, index) => {
							item.active = 0;
							settlementList.push(item);
						})
						this.settlementList = settlementList;
					}
				})
			},
			settlementChange(index, active) {
				this.settlementList[index].active = Math.abs(active - 1);
				let settlement = '';
				this.settlementList.forEach((item, i) => {
					if (item.active == 1) {
						settlement += item.id + ',';
					}
				})
				this.settlement = settlement;
			},
			others(i) {
				if (i == 1) {
					this.extype1 = Math.abs(this.extype1 - 1);
				} else if (i == 2) {
					this.extype2 = Math.abs(this.extype2 - 1);
				} else if (i == 3) {
					this.extype3 = Math.abs(this.extype3 - 1);
				} else if (i == 4) {
					this.extype4 = Math.abs(this.extype4 - 1);
				}
			},
			//获取人员构成
			getPersonList() {
				index.getPublicUserMember({}, 'client/public/find/staff', 'get', res => {
					if (res.data.code == 200 && res.data.success) {
						this.personList = res.data.result;
					}
				})
			},
			closezg(){
				this.showzg=false
			},
			personopen() {
				this.personshow = true
			},
			personclose() {
				this.personshow = false
			},
			personChange(id) {
				this.staffType = id;
			},
			personDefine() {
				this.personshow = false;
				this.pages = 0;
				this.cardList = [];
				this.pageIndex = 0;
				this.notMore = 0;
				this.getTopWorkerList();
				this.getWorkerList();
			},
			getTopWorkerList() {
				let sendpostData = {
					'type': this.type,
				};
				if (this.skills != 0) {
					sendpostData.skills = this.skills; //工种
				}
				if (this.cityId != 0) {
					sendpostData.cityId = this.cityId; //城市
				}
				if (this.staffType != 0) {
					sendpostData.staffType = this.staffType; //人员构成
				}
				if (this.mastery != 0) {
					sendpostData.mastery = this.mastery; //熟练度
				}
				if (this.ageSection != 0) {
					sendpostData.ageSection = this.ageSection; //年龄段
				}
				if (this.workType1 != 0) {
					sendpostData.workType1 = this.workType1; //长短工
				}
				if (this.settlement != 0) {
					sendpostData.settlement = this.settlement; //结算方式
				}
				if (this.extype1 != 0) {
					sendpostData.extype1 = this.extype1;
				}
				if (this.extype2 != 0) {
					sendpostData.extype2 = this.extype2;
				}
				if (this.extype3 != 0) {
					sendpostData.extype3 = this.extype3;
				}
				if (this.extype4 != 0) {
					sendpostData.extype4 = this.extype4;
				}
				index.getPublicMember(sendpostData, '/client/public/topCards', 'post', resc => {
					if (resc.data.code == 200 && resc.data.success) {
						this.topcardList = resc.data.result
					}
				})
			},
			//根据条件查询好活列表
			getWorkerList() {
				// uni.showLoading({
				// 	title: '加载中'
				// });
				let sendpostData = {
					'type': this.type,
				};
				if (this.skills != 0) {
					sendpostData.skills = this.skills; //工种
				}
				if (this.cityId != 0) {
					sendpostData.cityId = this.cityId; //城市
				}
				if (this.staffType != 0) {
					sendpostData.staffType = this.staffType; //人员构成
				}
				if (this.mastery != 0) {
					sendpostData.mastery = this.mastery; //熟练度
				}
				if (this.ageSection != 0) {
					sendpostData.ageSection = this.ageSection; //年龄段
				}
				if (this.workType1 != 0) {
					sendpostData.workType1 = this.workType1; //长短工
				}
				if (this.settlement != 0) {
					sendpostData.settlement = this.settlement; //结算方式
				}
				if (this.extype1 != 0) {
					sendpostData.extype1 = this.extype1;
				}
				if (this.extype2 != 0) {
					sendpostData.extype2 = this.extype2;
				}
				if (this.extype3 != 0) {
					sendpostData.extype3 = this.extype3;
				}
				if (this.extype4 != 0) {
					sendpostData.extype4 = this.extype4;
				}
				sendpostData.pageIndex = this.pageIndex;
				sendpostData.pageSize = this.pageSize;
				let pcard = [],
					tcard = [],
					cardList = [];
				index.getPublicMember(sendpostData, '/client/public/listCards', 'post', res => {
					if (res.data.code == 200 && res.data.success && res.data.result.length > 0) {
						pcard = res.data.result;
						this.$nextTick(() => {
							if (this.pageIndex > 0) {
								if (this.topcardList[this.pageIndex * 2]) {
									let topfrist = this.topcardList[this.pageIndex * 2];
									topfrist.top = 1;
									this.cardList.push(topfrist);
								}
								if (this.topcardList[this.pageIndex * 2 + 1]) {
									let toptwo = this.topcardList[this.pageIndex * 2 + 1];
									toptwo.top = 1;
									this.cardList.push(toptwo);
								}
								pcard.forEach((item, index) => {
									this.cardList.push(item);
								})
							} else {
								if (this.topcardList[this.pageIndex * 2]) {
									let topfrist = this.topcardList[this.pageIndex * 2];
									topfrist.top = 1;
									cardList.push(topfrist);
								}
								if (this.topcardList[this.pageIndex * 2 + 1]) {
									let toptwo = this.topcardList[this.pageIndex * 2 + 1];
									toptwo.top = 1;
									cardList.push(toptwo);
								}
								pcard.forEach((item, index) => {
									cardList.push(item);
								})
								this.cardList = cardList;
							}
							this.pageIndex += 1;
							uni.hideLoading();
						})
					} else {
						this.notMore = 1;
						console.log(this.notMore);
					}
				})


			},
			tabNavChild(item, index) {
				this.current = index
				this.type = index
				this.pages = 0;
				this.cardList = [];
				this.pageIndex = 0;
				this.notMore = 0;
				this.getTopWorkerList();
				this.getWorkerList();
			},
			postPerson() {
				uni.showLoading({
					title: '加载中'
				});
				this.getPersonList();
				this.personshow = true;
				uni.hideLoading();
			},
			postSaixuan() {
				uni.showLoading({
					title: '加载中'
				});
				this.getAgeList();
				this.getMasteryList();
				this.getSettlementList();
				this.getWorkTypeList();
				this.saixuanshow = true;
				uni.hideLoading();
			},
			saixuanopen() {
				this.saixuanshow = true;
			},
			saixuanclose() {
				this.saixuanshow = false;
			},
			defineChange() {
				this.saixuanshow = false;
				this.pages = 0;
				this.cardList = [];
				this.pageIndex = 0;
				this.notMore = 0;
				this.getTopWorkerList();
				this.getWorkerList();
			},
			clearChange() {
				this.saixuanshow = false;
			},
			//获取省市区数据列表
			getCityList() {
				uni.showLoading({
					title: '加载中'
				});
				index.getPublicUserMember({}, 'client/public/find/areaList', 'get', res => {
					if (res.data.code == 200 && res.data.success) {
						let cityList = res.data.result;
						let province = [];
						cityList.forEach((item, index) => {
							if (item.pid == 0) {
								item.active = 0;
								let city = [];
								cityList.forEach((t, ti) => {
									if (t.pid == item.id) {
										t.active = 0;
										let county = [];
										cityList.forEach((th, tc) => {
											if (th.pid == t.id) {
												th.active = 0;
												county.push(th);
											}
										})
										t.child = county;
										city.push(t);
									}
								})
								item.child = city;
								province.push(item);
							}
						});
						this.cityLists = province;
						province[0].active = 1;
						this.provinceList = province;
						this.cityList = province[0].child;
						this.countyList = province[0].child[0].child;
						uni.hideLoading();
					}
				})
			},
			cityClick(item, inx, type) {
				if (type === 1) {
					this.cityList = item.child;
					this.countyList = item.child[0].child;
					this.provinceList.forEach((v, i) => {
						if (v.active == 1) {
							this.provinceList[i].active = 0;
						}
					})
					this.provinceList[inx].active = 1;
				} else if (type === 2) {
					this.cityId = item.id;
					this.cityName = item.name;
					this.pages = 0;
					this.cardList = [];
					this.pageIndex = 0;
					this.notMore = 0;
					this.getTopWorkerList();
					this.getWorkerList();
					this.$refs.city.close();

					this.countyList = item.child;
					let num = 0;
					this.cityList.forEach((v, i) => {
						if (this.cityList[i].active == 1) {
							num += 1;
						}
					})
					if (num >= 3) {
						index.show_tips('城市选择不能超过3个');
						return false;
					}
					this.cityList[inx].active = 1;
				} else if (type === 3) {
					this.countyList.forEach((v, i) => {
						if (v.active == 1) {
							this.countyList[i].active = 0;
						}
					})
					this.countyList[inx].active = 1;
				}
			},
			cleanAddresIndex() {
				this.getCityList();
				if (uni.getStorageSync('token')) {
					this.$refs.city.show()
				} else {
					index.show_tips('请先登录')
					setTimeout(() => {
						index.navigate_to('/pagesC/login/login')
					}, 300)
					return false
				}

			},
			//清除选中的地址
			cleanNew() {
				this.hopeAddrIds = '';
				this.hopeAddrName = '';
				this.$refs.city.close()
			},
			citySure() {
				let hopeAddrIds = '',
					hopeAddrName = '';
				this.cityList.forEach((v, i) => {
					if (this.cityList[i].active == 1) {
						hopeAddrIds += v.id + ',';
						hopeAddrName += v.name + ',';
					}
				})
				if (!hopeAddrIds || !hopeAddrName) {
					index.show_tips('请选择省市区')
					return false
				}
				this.formData.hopeAddrIds = hopeAddrIds;
				this.formData.hopeAddrName = hopeAddrName;
				this.$refs.city.close();
			},
			//跳转到选择工种页面
			checkNavGongZhong() {
				uni.showLoading({
					title: '加载中'
				});
				this.getQueryType();
				this.$refs.gongzhong.show();
				return false;
			},
			//查询工种
			getQueryType() {
				let types = "construction"
				this.Qurylist = []
				index.getPublicMember({}, 'client/skills/list/' + types, 'get', res => {
					if (res.data.success && res.data.code == 200) {

						let arr = res.data.result
						let gzarr = [];
						if (arr.length > 0) {
							for (let i = 0; i < arr.length; i++) {
								if (arr[i].slevel == 2) {
									this.Qurylist.push({
										name: arr[i].skillName,
										id: arr[i].id
									})
									gzarr.push(arr[i]);
								}
							}
							//console.log(gzarr,'=====gzarr====gzarr')
							//把三级工种压到二级工种里面
							if (gzarr.length > 0) {
								for (let j = 0; j < gzarr.length; j++) {
									gzarr[j].child = []
									for (let m = 0; m < arr.length; m++) {
										if (arr[m].pid == gzarr[j].id && arr[m].slevel == 3) {
											gzarr[j].child.push(arr[m])
										}
									}
								}
							}
							this.gongzhongList = gzarr;
						} else {
							this.gongzhongList = []
						}
					} else {
						this.Qurylist = []
						this.gongzhongList = []
					}
					uni.hideLoading();
				})
			},
			//点击工种二级类型 切换下标
			gzTaskLevelone(item, gzindex) {
				this.gzlevelone = gzindex;
				this.gzleveltwo = '';
			},
			//切换三级工种 类型 下标
			gzTaskLevelTwo(item, gzindex) {
				this.skills = item.id;
				this.skillsName = item.skillName;
				this.pages = 0;
				this.cardList = [];
				this.pageIndex = 0;
				this.notMore = 0;
				this.getTopWorkerList();
				this.getWorkerList();
				this.$refs.gongzhong.close();
				this.isclickgztwo = true;
				if (this.selectCheckgognzhong.length >= 3) {
					index.show_tips('所选工种不能超过3个')
					return false
				} else {
					this.selectCheckgognzhong.push(item);
					this.gzleveltwo = gzindex;
				}
			},
			//移除选中的工种
			delSelectgz(se, sc) {
				if (this.selectCheckgognzhong.length > 0) {
					this.selectCheckgognzhong.splice(sc, 1)
					//delete this.selectCheckgognzhong[sc]
				}
			},
			//清空选中的工种
			cleanGongZhongIndex() {
				this.gzlevelone = 0
				this.gzleveltwo = 0
				this.selectCheckgognzhong = []
				this.form.objType = ''
				//this.$refs.gongzhong.close()
			},
			//确定选中的工种进行查询
			getCheckGongZhong() {
				if (this.selectCheckgognzhong.length == 0) {
					index.show_tips('请先去选择要查询的工种')
					return false
				}
				let skillsId = '',
					skillsName = '';
				this.selectCheckgognzhong.forEach((item, index) => {
					skillsId += item.id + ',';
					skillsName += item.skillName + ',';
				})
				this.formData.skillsId = skillsId;
				this.formData.skillsName = skillsName;
				this.$refs.gongzhong.close();
			},
			cutstr(str, len) {
				var str_length = 0;
				var str_len = 0;
				var str_cut = new String();
				str_len = str.length;
				for (var i = 0; i < str_len; i++) {
					var a = str.charAt(i);
					str_length++;
					if (escape(a).length > 4) {
						//中文字符的长度经编码之后大于4  
						str_length++;
					}
					str_cut = str_cut.concat(a);
					if (str_length >= len) {
						str_cut = str_cut.concat("...");
						return str_cut;
					}
				}
				//如果给定字符串小于指定长度，则返回源字符串；  
				if (str_length < len) {
					return str;
				}
			},
			btnClick() {
				this.showzg = false
				if (!uni.getStorageSync('token')) {
					index.navigate_to('/pagesC/login/login');
					return false
				} else {
					if (this.homepage.isEnterprise == 1) {
						uni.navigateTo({
							url: "/pagesB/changeIdentity/changeIdentity?type=1"
						})
					} else {
						uni.navigateTo({
							url: "/pagesC/job/issuejob?address=" + this.cityName + '&entid=' + this.enIdentity
						})
					}
				}
			},
			btnClick2() {
				this.showzg = false
				console.log(this.userinfo);
				// if (!uni.getStorageSync('token')) {
				// 	index.navigate_to('../../pagesC/login/login');
				// } else if (!this.userinfo.nickName) {
				// 	let url = "/pagesC/my/MyEditUserInfo"
				// 	index.navigate_to(url)
				// } else {
				// 	let url = "/pagesB/releaseWork/index"
				// 	index.navigate_to(url)
				// }
				if (uni.getStorageSync('token')) {
					// index.navigate_to(url)
					let uid = uni.getStorageSync('userid')
					console.log('当前登录的用户id是', this.uid)
					uni.navigateTo({
						url:'/pagesC/my/MyEditUserInfo?type=1&userId='+uid
					})
				} else {
					uni.navigateTo({
						url: "/pagesC/login/login"
					});
				}
			},
			btnTouchstart() {},
			btnTouchend() {},
			//跳转到详情页
			JumpNext(item) {
				let sends = {
					"userId" : uni.getStorageSync("userid")?uni.getStorageSync("userid"):'',
					"clientType":1,
					"pages":'card',
					"businessId":item.id
				}
				index.getPublicUserMember(sends, '/visitLog/add', 'post', res => {
					if (res.statusCode == 200 && res.data.success) {
						console.log('日活统计',res)
					} else {
						console.log('日活统计失败',res)
					}
				})
				// index.navigate_to('../../pagesB/workInfo/RecruitmentInfo?id='+item.id)
				index.navigate_to('../../pagesC/my/MyEditUserInfo?type=0&&userId=' + item.id + '&&ordernumber=' + this.homepage.orderNumber + '&&entid=' + this.homepage.enIdentity)
			},
			strHandle(str, char = ',') {
				str = index.strTrim(str, char);
				return index.strRep(str, ',', '、');
			}
		}
	}
</script>
<style>
	@import url("index.css");
</style>
<style lang="scss" scoped>
	@import url("@/static/css/publics.css");

	::v-deep {
		.u-navbar--fixed {
			background-image: url('https://xgr.oss-cn-hangzhou.aliyuncs.com/icon/images/bg1.png');
			background-size: 100%;
			background-repeat: no-repeat;

			// background-image: linear-gradient(to bottom, #42cdff, #0288ff);
			&>view {
				background: transparent !important;
			}

			.leftText {
				color: #fff;
				font-weight: bold;
				font-size: 36rpx;

			}
		}
	}

	.setTop {
		padding: 20rpx;
		max-height: 60vh;

		.title {
			text-align: center;
			font-size: 36rpx;
			color: #3D3D3D;
			margin-bottom: 32rpx;
			display: -moz-box;
			-moz-line-clamp: 2;
			-moz-box-orient: vertical;
			overflow-wrap: break-word;
			word-break: break-all;
			white-space: normal;
			overflow: hidden;

		}

		.userMp {
			display: flex;
			background: #F4F4F4;
			border-radius: 6rpx;
			padding: 20rpx;
			margin-bottom: 20rpx;

			image {
				width: 104rpx;
				height: 104rpx;
				border-radius: 6rpx;
				margin-right: 22rpx;
			}

			.userName {
				flex: 1;

				.userNameS {
					display: flex;
					margin-bottom: 18rpx;

					view:nth-child(1) {
						color: #0f0f0f;
						font-size: 36rpx;
						line-height: 42rpx;
						font-weight: bold;
					}

					image {
						width: 32rpx;
						height: 32rpx;
						margin-left: 14rpx;
						margin-right: 10rpx;
						margin-top: 10rpx;
					}

					view:nth-child(3) {
						color: #a1a1a1;
						font-size: 24rpx;
						margin: 0rpx;
					}
				}

				.userNameC {
					color: #424242;
					font-size: 26rpx;

					text {
						margin-right: 32rpx;
					}
				}
			}

			view:nth-child(3) {
				margin-top: 32rpx;
				color: #424242;
			}
		}

		.job {
			background: #F4F4F4;
			padding: 32rpx 20rpx;
			margin-bottom: 20rpx;
			border-radius: 6rpx;

			view:nth-child(1) {
				font-size: 36rpx;
				line-height: 42rpx;
				margin-bottom: 20rpx;
				display: -moz-box;
				-moz-line-clamp: 2;
				-moz-box-orient: vertical;
				overflow-wrap: break-word;
				word-break: break-all;
				white-space: normal;
				overflow: hidden;
			}

			view:nth-child(2) {
				font-size: 26rpx;
				line-height: 31rpx;
			}
		}

		.active {
			background: #0575ff;
			color: #fff;

			.userName {
				.userNameS {
					view:nth-child(1) {
						color: #fff !important;
					}

					view:nth-child(3) {
						color: #fff !important;
					}
				}

				.userNameC {
					color: #fff !important;
				}
			}

			view:nth-child(3) {
				color: #fff !important;
			}
		}
	}

	.content {
		background-image: url('https://xgr.oss-cn-hangzhou.aliyuncs.com/icon/images/bg1.png');
		background-size: 100%;
		background-repeat: no-repeat;
	}

	.right {
		color: #fff;
	}
.zgbtn{
		margin-top: 20rpx;
		padding: 0 20rpx;
		box-sizing: border-box;
	}
	.index {
		.searchTop {
			display: flex;
			padding: 20rpx 20rpx 20rpx 20rpx;

			// align-items: center;
			.logo {
				width: 200px;
				height: 64rpx;

				// margin-right: 10rpx;
				image {
					width: 60px;
					height: 60px;
				}

				text {
					width: 130px;
					height: 60px;
				}
			}

			.search {
				// flex: 1;
				display: flex;
				background: rgba($color: #fff, $alpha: 0.3);
				height: 60rpx;
				// padding: 0 10rpx;
				border-radius: 8rpx;
				margin-right: 20rpx;
				margin-left: 20rpx;

				::v-deep {
					.u-input {
						margin: 0 10rpx;
					}
				}
			}
			
		}
	}
</style>